;((8 9 4) (5 9 1) (5 6 2) (4 6 1))

(defun curious-fract (a b c)
  (or ;(= (/ (+ (* a 10) c) (+ (* b 10) c)) (/ a c))
      ;(= (/ (+ (* c 10) a) (+ (* c 10) b)) (/ a c))
      (= (/ (+ (* a 10) c) (+ (* c 10) b)) (/ a c))
      ))

(defun find-fracts()
  (loop for i from 1 to 9
		    with result = nil
		    do (loop for j from 1 to 9
			  do (loop for k from 1 to 9
				when (and (/= i j k) (curious-fract i j k))
				do (setq result (cons (list i j k) result))))
		    finally (return result)))

(defun list-fracts(fracts)
  (mapcar #'(lambda (x) (/ (car x) (cadr x))) fracts))

(defun probl33()
  (reduce #'* (list-fracts (find-fracts))))
